#ifndef _LORA_H_
#define _LORA_H_
#include "radio.h"
#include "sx1280.h"
#include "example.h"

#define  TX_DEBUG

#define FIRMWARE_VERSION    ( ( char* )"Firmware Version: 5709de2d" )
#define MODE_LORA
#define RF_BL_ADV_CHANNEL_38             			2426000000 // Hz
//#define RF_BL_ADV_CHANNEL_0                     	2404000000 // Hz
//#define RF_FREQUENCY                                RF_BL_ADV_CHANNEL_0 // Hz
#define TX_OUTPUT_POWER                             4
#define BUFFER_SIZE                                 128
#define TX_TIMEOUT_VALUE                            0 // ms
#define RX_TIMEOUT_VALUE                            0 // ms
#define RX_TIMEOUT_TICK_SIZE                        RADIO_TICK_SIZE_1000_US
#define PINGPONGSIZE                                4
typedef enum
{
    APP_LOWPOWER,
    APP_RX,
    APP_RX_TIMEOUT,
    APP_RX_ERROR,
    APP_TX,
    APP_TX_TIMEOUT,
}AppStates_t;

void OnTxDone( void );
void OnRxDone( void );
void OnTxTimeout( void );
void OnRxTimeout( void );
void OnRxError( IrqErrorCode_t errorCode );
void OnRangingDone( IrqRangingCode_t val );
void OnCadDone( bool channelActivityDetected );

void sx1280_int(uint8_t fre);
void sx1280_update_freq(uint8_t fre);
void txparam_to_base_station(uint8_t length);
void txparam_to_light(uint8_t length);
void startRx(void);
#endif